<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<link rel="stylesheet" th:href="@{/assets/css/colorbox.css}"/>
<link rel="stylesheet" th:href="@{/assets/css/fixedColumns.dataTables.css}"/>
<link rel="stylesheet" th:href="@{/assets/css/jquery.dataTables.min.css}"/>
<head th:include="fragments/head::header"/>
<style type="text/css">
    .error {
        color: #F00
    }

    .DTFC_LeftBodyLiner {
        height: 910px ! important;
    }
</style>
<body style='overflow:visible ! important;'>
<div th:include="fragments/top::top"></div>
<div class="main-container" id="main-container">
    <div class="main-container-inner">
        <div th:include="fragments/left::left" class="sidebar" id="sidebar"></div>
        <div class="main-content">
            <div class="page-content">
                <div class="row">
                    <div class="col-xs-12">
                        <div class="row">
                            <div class="col-xs-12">
                                <h3 class="header smaller lighter blue">所有定校方案列表</h3>
                                <!--<shiro:hasPermission name="审核定校方案_规划组">
                                    <input type="hidden" id="isPlanning" th:value="1"/>
                                </shiro:hasPermission>-->
                                <shiro:hasRole name="运营人员">
                                    <input type="hidden" id="isOperator" th:value="1"/>
                                </shiro:hasRole>
                                <input type="hidden" name="studentNo" id="studentNo"
                                       th:value="${#httpServletRequest.getParameter('studentNo')}"/>
                                <input type="hidden" id="currentUser" th:value="${session.user.oaid}"/>
                                <input type="hidden" id="planCollegeInfoUrl" th:value="${planCollegeInfoUrl}"/>
                                <input type="hidden" id="planCollegeAuditUrl" th:value="${planCollegeAuditUrl}"/>
                                <div class="table-header" style="height: 42px">
                                    <form class="form-inline">
                                        <div class="form-group">
                                            <label for="student_no">学号：</label>
                                            <input type="text" id="student_no" class="form-control input-sm"
                                                   placeholder="" style="width:100px;"/>
                                        </div>
                                        <div class="form-group">
                                            <label for="student_no">姓名：</label>
                                            <input type="text" id="student_name" class="form-control input-sm"
                                                   placeholder="" style="width:100px;"/>
                                        </div>
                                        <div class="form-group">
                                            <label for="pinyin">拼音：</label>
                                            <input type="text" id="pinyin" class="form-control input-sm"
                                                   placeholder="" style="width:100px;"/>
                                        </div>
                                        <div class="form-group">
                                            <label for="copyOperator">文签顾问：</label>
                                            <input type="text" id="copyOperator" class="form-control input-sm"
                                                   placeholder="" style="width:100px;"/>
                                        </div>
                                        <div class="form-group">
                                            <label >状态：</label>
                                            <select type="" class="form-control input-sm" id="status"
                                                    style="width:100px;">
                                                <option value="" selected="selected">-全部-</option>
                                                <option value="1">文案未接受</option>
                                                <option value="3">文案已接受</option>
                                                <option value="4">文案已拒绝</option>
                                            </select>
                                        </div>
                                        <div class="form-group">
                                            <label >国家：</label>
                                            <select type="" class="form-control input-sm" id="countryName"
                                                    style="width:100px;">
                                                <option value="" selected="selected">-全部-</option>
                                                <option th:each="country:${listCountryName}" th:value="${country.id}" th:text="${country.countryName}"></option>

                                            </select>
                                        </div>
                                        <button type="button" id="query" class="btn btn-success ">查询</button>
                                        <button type="reset" class="btn btn-warning">清空</button>
                                    </form>
                                </div>

                                <div class="table-responsive">
                                    <div id="alert" class="alert alert-success" style="display: none;" role="alert">
                                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                                            <span aria-hidden="true">&times;</span>
                                        </button>
                                        <span id="alertText"></span>
                                    </div>
                                    <table id="sample-table-2" class="table table-striped table-bordered table-hover"
                                           style="white-space: nowrap;">
                                        <thead>
                                        <tr>
                                            <th class="hide">id</th>
                                            <th>学号</th>
                                            <th>学生姓名</th>
                                            <th>审批信息</th>
                                            <th>定校信息</th>
                                            <th style="width:75px">操作</th>
                                            <th>作废定校方案</th>
                                            <th>定校编号</th>
                                            <th>申请类别</th>
                                            <th>国家</th>
                                            <th>分支机构</th>
                                            <th>院校名称</th>
                                            <th>专业</th>
                                            <th>咨询顾问</th>
                                            <th>文签顾问</th>
                                            <th>状态</th>
                                            <th>合同类型</th>
                                            <th>签约时间</th>
                                            <th>开课时间</th>
                                            <th>申请截止时间</th>
                                            <th>申请截止时间备注</th>
                                        </tr>
                                        </thead>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- /.col -->
                </div>
                <!-- /.row -->
            </div>
            <!-- /.page-content -->
        </div>

        <div th:include="fragments/bottom::bottom"></div>
    </div>

    <a href="#" id="btn-scroll-up"
       class="btn-scroll-up btn btn-sm btn-inverse"> <i
            class="icon-double-angle-up icon-only bigger-110"></i>
    </a>
</div>
<!-- /.main-container -->

<!-- Modal备注 -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content"></div>
    </div>
</div>
<div th:include="fragments/js::js"></div>

<script th:src="@{/assets/js/jquery.validate.min.js}"></script>
<script th:src="@{/assets/js/jquery.validate.zh-CN.js}"></script>
<!-- page specific plugin scripts -->
<script charset="UTF-8" th:src="@{/assets/js/1.10.15/jquery.dataTables.min.js}"></script>
<script charset="UTF-8" th:src="@{/assets/js/jquery.dataTables.bootstrap.js}"></script>
<script charset="UTF-8" th:src="@{/assets/js/dataTables.fixedColumns.js}"></script>
<script th:src="@{/assets/js/temp.js}" charset="UTF-8"></script>
<script th:src="@{/business/followService/followService.js}" charset="UTF-8"></script>
<!--图片查看器-->
<script th:src="@{/assets/js/jquery.colorbox-min.js}"></script>
<script th:src="@{/layer/layer.js}"></script>
</body>
<!--<script th:src="@{/assets/js/date-time/moment.min.js}"></script>-->
<script type="text/javascript">
    <!--
    var currentUser = $("#currentUser").val();
    var oTable1;
    $("#sStatus").val($("#status").val());

    jQuery(function ($) {

        oTable1 = $('#sample-table-2').dataTable({
            "aLengthMenu": [10,20],  //用户可自选每页展示数量 5条或10条
            // "sScrollY": "450px",
            "scrollX": true,//控制在列过多过宽是,是否出现水平滚动条
            "scrollCollapse": true,
            "bProcessing": true,//显示搜索样式
            "bDeferRender": true,//延迟加载表格
            "fixedColumns": { //固定列的配置项
                "leftColumns": 6, //固定左边第一列
            },
            "bFilter": false,//是否使用搜索
            "sPaginationType": "bs_normal",//分页样式
            "bRetrieve": true,//是否调用后台
            "bServerSide": true,//是否以后台分页
            "bAutoWidth": true,
            "sAjaxSource": "/calibrationScheme/list",//请求路径
            "fnServerData": function (sSource, aoData, fnCallback) {
                aoData.push(
                    {"name": "cid", "value": $("#countryName").val() != "" ? $("#countryName").val() : null},
                    {"name": "auditStatus", "value": $("#status").val() != "" ? $("#status").val() : null},
                    {"name": "studentNo", "value": $("#student_no").val() != "" ? $("#student_no").val() : null},
                    {"name": "studentName", "value": $("#student_name").val() != "" ? $("#student_name").val() : null},
                    {"name": "pinyin", "value": $("#pinyin").val() != "" ? $("#pinyin").val() : null},
                    {"name": "copyOperator", "value": $("#copyOperator").val() != "" ? $("#copyOperator").val() : null}
                )
                $.ajax({
                    "dataType": 'json',
                    "type": "POST",
                    "url": sSource,
                    "data": aoData,
                    "success": fnCallback
                });
            },
            "aaSorting": [[0, "desc"]],
            "bSort": true,
            "aoColumns": [
                {"sClass": "center", "bVisible": false, "mData": "id"},//此列不显示
                {"sClass": "center", "bSortable": false,"mData":"student_no"},
                {"sClass": "center", "bSortable": false,sWidth:"16%", "mData": "student_name"},
                {
                    "sClass": "center", "bSortable": false, "mData": function (data) {
                    var check = '<a href="javascript:void(0);" onclick="toApproveURL(' + data.id + ')" >点击查看</a>';
                    return check;
                }
                },
                {
                    "sClass": "center", "bSortable": false, "mData": function (data) {
                    var check = '<a href="javascript:void(0);" onclick="toPlanCollegeURL('+data.id+')">点击查看</a>';
                    return check;
                }
                },
                {
                    "sClass": "center", "bSortable": false, "mData": function (data) {
                    var operatorStudentConfirm = "";
                    if ($("#isOperator").val() == "1") {
                        operatorStudentConfirm = '<a class="blue" href="javascript:void(0);" onclick="operatorStudentConfirm(\'' + data.id + '\',\'' + data.studentNo + '\')" >运营确认</a>';
                    }
                    if(data.audit_status == 0){
                        return "经理未审核";
                    }
                    else if(data.audit_status == 2){
                        return "经理已驳回";
                    }
                    else if(data.audit_status == 3){
                        return "文签已接受";
                    }

                    else if(data.audit_status == 4){
                        return "已驳回";
                    }
                    else if(data.audit_status == 5){
                        return "学生已接受";
                    }
                    else if(data.audit_status == -1){
                        return "学生已驳回";
                    }
                    else if(data.audit_status == 6){
                        if(data.studentConfirmStatus == 1){
                            return operatorStudentConfirm
                        }
                        if(data.studentConfirmStatus == 2) {
                            return "学生已确认";
                        }
                    }
                    else if(data.audit_status == 1){
                        if(data.studentConfirmStatus == 1){
                            return operatorStudentConfirm
                        }
                        else if(data.studentConfirmStatus == 2){
                            if(data.nation_id == 4 && data.usa_status == 1){
                                return "规划未审核";
                            }
                            else {
                                return "学生已确认";
                            }

                        }
                        else if(data.studentConfirmStatus == 0){
                            if(data.nation_id == 4 && data.usa_status == 1){
                                return "规划待审核";
                            }
                            else{
                                return "暂无法确认";
                            }
                        }
                        else{
                            return "";
                        }

                    }
                    else{
                        return "";
                    }
                    /*]]>*/
                }
                },
                {"sClass": "center", "bSortable": false, "mData":function (data) {
                    var toVoidPlanCollage = "";
                    if ($("#isOperator").val() == "1") {
                      return  toVoidPlanCollage = '<a class="blue" href="javascript:void(0);" onclick="toVoidPlanCollage(\'' + data.id + '\',\''+data.audit_status+'\')" >作废定校方案</a>';
                    }
                    return "";
                }},
                {"sClass": "center", "bSortable": false, "mData": "planId"},
                {
                    "sClass": "center", "bSortable": false, "mData":
                    function (data) {
                        if (data.apply_type == 0) {
                            return "直录"
                        }
                        if (data.apply_type == 1) {
                            return "双录"
                        }
                        if (data.apply_type == 2) {
                            return "纯语言"
                        }
                        return "";
                    }
                },
                {"sClass": "center", "bSortable": false, "mData": "country_name"},
                {"sClass": "center", "bSortable": false, "mData": "branch_name"},
                {"sClass": "center", "bSortable": false, "mData":function (data) {
                    if (data.college_name !=null) return data.college_name;
                    return "";
                }
                },
                {"sClass": "center", "bSortable": false, "mData":
                    function (data) {
                        if (data.major_name !=null) return data.major_name;
                        return "";
                    }
                },
                {"sClass": "center", "bSortable": false, "mData": "sales_consultant"},
                {
                    "sClass": "center", "bSortable": false, "mData":
                    function (data) {
                        if (data.copy_operator != null) return data.copy_operator;
                        return "";
                    }
                },
                {
                    "sClass": "center", "bSortable": false, "mData": function (data) {
                    if(data.audit_status == 0){
                        return "经理未审核";
                    }
                    else if(data.audit_status == 2){
                        return "经理已驳回";
                    }
                    else if(data.audit_status == 3){
                        return "文签已接受";
                    }

                    else if(data.audit_status == 4){
                        return "已驳回";
                    }
                    else if(data.audit_status == 5){
                        return "学生已接受";
                    }
                    else if(data.audit_status == -1){
                        return "学生已驳回";
                    }
                    else if(data.audit_status == 6){
                        if(data.studentConfirmStatus == 1){
                            return "学生未确认";
                        }
                        if(data.studentConfirmStatus == 2) {
                            return "学生已确认";
                        }
                    }
                    else if(data.audit_status == 1){
                        if(data.studentConfirmStatus == 1){
                            return "学生未确认";
                        }
                        else if(data.studentConfirmStatus == 2){
                            if(data.nation_id == 4 && data.usa_status == 1){
                                return "规划未审核";
                            }
                            else {
                                return "学生已确认";
                            }

                        }
                        else if(data.studentConfirmStatus == 0){
                            if(data.nation_id == 4 && data.usa_status == 1){
                                return "规划待审核";
                            }
                            else{
                                return "暂无法确认";
                            }
                        }
                        else{
                            return "";
                        }

                    }
                    else{
                        return "";
                    }
                }
                },
                {
                    "sClass": "center", "bSortable": false, "mData": function (data) {
                    if (data.contract_type == 1) return "全程";
                    if (data.contract_type == 2) return "单申请";
                    if (data.contract_type == 3) return "单文书";
                    if (data.contract_type == 4) return "单签证";
                    return "";
                }
                },
                {"sClass": "center", "bSortable": false, "mData":
                    function (data) {
                    if(data.sign_date!=null){
                        return getTimeString_day(new Date(data.sign_date))
                    }
                      return null;
                    }
                },
                {"sClass": "center", "bSortable": false, "mData":
                    function (data) {
                        if(data.course_start_time!=null){
                            return getTimeString_day(new Date(data.course_start_time))
                        }
                        return null;
                    }
                },
                {"sClass": "center", "bSortable": false, "mData":
                    function (data) {
                        if(data.apply_deadline!=null){
                            return getTimeString_day(new Date(data.apply_deadline))
                        }
                        return null;
                    }
                },
                {"sClass": "center", "bSortable": false, "mData":
                    function (data) {
                        if(data.apply_deadline_remark!=null){
                            return data.apply_deadline_remark;
                        }
                        return null;
                    }
                },
            ],
            "oLanguage": {
                "sLengthMenu": "每页 _MENU_条 ",
                "sZeroRecords": "对不起，查询不到任何相关数据",
                "sInfo": "当前显示 _START_ 到 _END_ 条，共 _TOTAL_ 条记录 ",
                "sInfoEmpty": "显示 0 到 0 条，共 0 条记录",
                "sInfoFiltered": "数据表中共为 _MAX_ 条记录)",
                "sProcessing": "正在加载中...",
                "sSearch": "搜索",
                "sUrl": "", //多语言配置文件，可将oLanguage的设置放在一个txt文件中，例：Javascript/datatable/dtCH.txt
                "oPaginate": {
                    "sFirst": "第一页",
                    "sPrevious": " 上一页 ",
                    "sNext": " 下一页 ",
                    "sLast": " 最后一页 "
                }
            }
            //多语言配置

        });


        //页面响应回车事件
        $(document).keyup(function (e) {//捕获文档对象的按键弹起事件
            if (e.keyCode == 13) {//按键信息对象以参数的形式传递进来了
                $("#query").click();
            }
        });



    })

    function changeTable() {
        oTable1.fnDraw()
    }

    $("#query").click(function () {
        oTable1.fnDraw();
    });
    function toPlanCollegeURL( id) {
        window.open('/selectStudentPlanCollegeDetails?planCollegeId=' + id);
    }

    //定校审批信息
    function toApproveURL(id) {
        window.open('/planCollege/AuditResultList?planCollegeId=' + id);
    }

    //学生确认
    function operatorStudentConfirm(id,studentNo) {
        parent.layer.confirm('是否通过审核？', {
            icon: 7,
            btn: ['确认', '取消']
            , btn1: function (index, layero) {
                $.ajax({
                    url: "/plan/studentConfirm",
                    type: "POST",
                    data: {
                        id: id,
                        studentNo: studentNo
                    },
                    success: function (data) {
                        if (data) {
                            layer.confirm('操作成功！', {
                                icon: 1,
                                btn: ['确认']
                                , btn1: function (index, layero) {
                                    $("#query").click();
                                    parent.layer.closeAll();
                                }
                            });
                        } else {
                            layer.confirm('操作失败，请联系管理员！', {
                                icon: 2,
                                btn: ['确认']
                                , btn1: function (index, layero) {
                                    $("#query").click();
                                    parent.layer.closeAll();
                                }
                            });
                        }
                    }
                });
            }
        })
    }


    //作废定校方案
    function toVoidPlanCollage(planCollagId,auditStatus) {
        parent.layer.confirm('是否作废定校方案？', {
            icon: 7,
            btn: ['确认', '取消']
            , btn1: function (index, layero) {
                $.ajax({
                    url: "/calibrationScheme/toVoidPlanCollage",
                    type: "POST",
                    data: {
                        id: planCollagId,
                        auditStatus: auditStatus

                    },
                    success: function (data) {
                        if (data.data.result==true) {
                            layer.confirm('操作成功！', {
                                icon: 1,
                                btn: ['确认']
                                , btn1: function (index, layero) {
                                    $("#query").click();
                                    parent.layer.closeAll();
                                }
                            });
                        } else {
                            layer.confirm('操作失败，请联系管理员！', {
                                icon: 2,
                                btn: ['确认']
                                , btn1: function (index, layero) {
                                    $("#query").click();
                                    parent.layer.closeAll();
                                }
                            });
                        }
                    }
                });
            }
        })
    }


    /*]]>*/


    -->

</script>

</html>
